<?php declare(strict_types=1);
$api = app('Dingo\Api\Routing\Router');

$apiHandler = function ($api) {

    $api->group(["namespace" => "App\Api\V2\Controller\Income", "prefix" => "v2/Income"], function ($api) {
        //开户流程
        $api->group(["prefix" => "Income", "middleware" => "user.api"], function ($api) {
            //查询开户信息
            $api->post("incomeQuery", "IncomeController@incomeQuery");
            //开户
        });
        $api->group(["prefix" => "Income"], function ($api) {
            $api->post("incomeNotify", "IncomeController@incomeNotify");
        });
    });

    //电子签
    $api->group(['namespace' => 'App\Api\V2\Controller\Elec', "prefix" => "v2/Elec", 'middleware' => 'user.api'], function ($api) {

        //开户流程
        $api->group(["prefix" => "OpenAccount"], function ($api) {
            //查询开户信息
            $api->post("openInfo", "OpenAccountController@openInfo");
            //开户
            $api->post("open", "OpenAccountController@open");
            //发送短信
            $api->post("sms", "OpenAccountController@sms");
        });

        //合同流程
        $api->group(["prefix" => "Contract"], function ($api) {
            //创建合同
            $api->post("createContract", "ContractController@createContract");
            //签署合同
            $api->post("agreeContract", "ContractController@agreeContract");
            //合同查询
            $api->post("queryContract", "ContractController@queryContract");
            //合同下载
            $api->post("downloadContract", "ContractController@downloadContract");
            //合同列表
            $api->post("listContract", "ContractController@listContract");
            //合同作废
            $api->post("cancelContract", "ContractController@cancelContract");
            //合同详情
            $api->post("detailContract", "ContractController@detailContract");

        });
    });
};

$api->version("v1", $apiHandler);